package cn.bellychang.command.demo03;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

/**
 * @author ChangLiang
 * @date 2020/4/26
 */
public class AppTest {

    @Test
    @DisplayName("test no-use-command pattern")
    public void test1(){
        // no use command pattern client do something command
        Barbecuer boy = new Barbecuer();
        boy.BakeChickenWing();
        boy.BakeMutton();
        // if using command pattern, then must import invoker and receiver
    }

    @Test
    @DisplayName("test command pattern")
    public void test(){
        //开店前的准备

        //首先调用Receiver
        Barbecuer boy = new Barbecuer();
        Command bakeMuttonCommand1 = new BakeMuttonCommand(boy);
        Command bakeMuttonCommand2 = new BakeMuttonCommand(boy);
        Command bakeChickenWingCommand1 = new BakeChickenWingCommand(boy);
        Waiter girl = new Waiter();

        //开门营业 顾客点菜
        girl.setOrder(bakeMuttonCommand1);
        girl.setOrder(bakeMuttonCommand2);
        girl.setOrder(bakeChickenWingCommand1);

        //点菜完闭，通知厨房
        girl.notifyExecute();

        girl.cancelOrder(bakeMuttonCommand1);
    }
}
